monchboxfandomcom-20200214-history
Torus.util
Torus.util contains utility functions for performing general or common tasks. It is comprised mostly of semantic type converters and string functions. Functions in Torus.util are required to have no side effects - they operate only on their arguments. util functions defined in Core are entirely self contained and do not reference any global variables, however some functions defined by ui.js and UI extensions read from option values. Core The following functions are defined in util.js, and are always available. debug for number of arguments passed }} null |notes = * Intended for use as a valid argument to any function that must accept a function, when no action is intended to be taken. }} cap : The capitalized string. |description = Returns a string that is identical to , except that the first character is capitalized. |complexity = for }} expiry_to_seconds : The number of seconds. |description = Converts a logical expiry, such as "2 days", into a number of seconds. |notes = *This is the functional inverse of . }} seconds_to_expiry : The logical expiry. |description = Converts a number of seconds into a logical expiry, such as "2 days". |notes = *This is the functional inverse of . }} int_to_stupid : The Stupid representation of . |description = Convert an integer to Stupid format. |complexity = for |notes = *Used by for sending all messages. *This is the functional inverse of . }} stupid_to_int : The integer representation of . |description = Convert a Stupid string to integer format. |complexity = for |notes = *Used by for receiving all messages. *This is the functional inverse of . }} load_js : The script tag used to load the script. |description = Load the script at on the current page. |complexity = |notes = *Does not rely on MediaWiki core functions. }} load_css : The link tag used to load the stylesheet. |description = Load the stylesheet at on the current page. |complexity = |notes = *Does not rely on MediaWiki core functions. }} UI extensions The following util functions are defined by the UI extension and its various sub extensions. color_hash : A six character hex color, with preceding #. |description = Convert a string into a hex color. |complexity = for }} timestamp : A date formatted hh:mm:ss. |description = Produce a zero-padded 24 hour timestamp. |complexity = }} parse_links can be used to link to pages on the loaded wiki. |return = : The same as , except that wikilinks have been converted to HTML links. |description = Expand all links in into HTML. This includes: * Explicit http:// links, eg. http://domain.com * External wikilinks, eg. display text * Internal wikilinks, eg. display text, including the pipe trick * Interwiki w:c:, wikipedia:, and mediawiki: links, eg. display |complexity = for }} normalize_pagename . |description = Normalize to a standard page name. This includes: * Capitalizing the namespace (if not mainspace). * Capitalizing the title. * Replacing all underscores with spaces. |complexity = for }} Category:Documentation Category:Torus documentation